import VInput from './VInput/VInput.vue'
import VInputButton from './VInput/VInputButton'
import VNoBorderSelect from './VSelect/VNoBorderSelect.vue'
import VDropdown from './VSelect/VDropdown.vue'
import VSlider from './VSlider/VSlider.vue'
import VSelectInput from './VSelect/VSelectInput.vue'
import VSelectCheckbox from './VSelect/VSelectCheckbox.vue'
import VSelectShowList from './VSelect/VSelectShowList'
import VHeader from './VHeader/VHeader.vue'
import VNumberSelect from './VSelect/VNumberSelect.vue'
import VWindowDataSelect from './VSelect/VWindowDataSelect.vue'
import vTreeMenu from './VTreeMenu/VTreeMenu'
import VEcharts from './VEcharts/VEcharts'
import VDialog from './VDialog/VDialog'

// 即席分析通用组件
import AInitPageCom from './AInitPage/AInitPageCom'
import ADialogCom from './AInitPage/ADialog/ADialogCom'
import ATableMenu from './AInitPage/ATableMenu/ATableMenu'
import ASearchCom from './AInitPage/ASearch/AsearchCom'
import ATable from './AInitPage/ATable/ATable'
import ATableReady from './AInitPage/ATable/ATableReady'
import ATable1 from './AInitPage/ATable/ATable1'
import ATableFit from './AInitPage/ATable/ATableFit'
import AButton from './AInitPage/AUnitList/AButton'
import ASearch from './AInitPage/AUnitList/ASearch'
import ASelect from './AInitPage/AUnitList/ASelect'
import ADropdown from './AInitPage/AUnitList/ADropdown'
import ATableRadioCom from './AInitPage/ATableRadio/ATableRadioCom'
import ATipInfoCom from './AInitPage/ATipInfo/ATipInfoCom'
// 自定义全局组件
import TestCharts from '../views/test/TestCharts'
import UserForm from '../views/usersmanagement/UserForm'
import RoleForm from '../views/usersmanagement/RoleForm'
import DepartmentForm from '../views/usersmanagement/DepartmentForm'
import PostMaintainForm from '../views/usersmanagement/PostMaintainForm'

let components = [
    VInput,
    VInputButton,
    VNoBorderSelect,
    VDropdown,
    VSlider,
    VSelectInput,
    VSelectCheckbox,
    VSelectShowList,
    VHeader,
    VNumberSelect,
    VWindowDataSelect,
    vTreeMenu,
    VEcharts,
    VDialog,
    AInitPageCom,
    ADialogCom,
    ATableMenu,
    ASearchCom,
    ATable,
    ATableReady,
    ATable1,
    AButton,
    ASearch,
    ASelect,
    ADropdown,
    ATableFit,
    ATableRadioCom,
    ATipInfoCom,
    // 自定义全局组件
    TestCharts,
    UserForm,
    RoleForm,
    DepartmentForm,
    PostMaintainForm
]

let installComponents = (Vue) => {
    // 安装导入的组件
    for (let i = 0, comp; i < components.length; i++) {
        comp = components[i]
        if (comp.name) {
            Vue.component(comp.name, comp)
        } else {
            console.error('发现一个组件没有定义组件名称！~', comp)
        }
    }
}

// 如果vue是全局变量,使用自动全局安装。
if (typeof window !== 'undefined' && window.Vue) {
    installComponents(window.Vue)
}

export default {
    install (Vue) {
        // 安装组件
        installComponents(Vue)
    },
    version: '1.0' // 版本号
}
